<html>
<head><meta charset="utf-8"><title>Musing on `unsafe` fields · project-safe-transmute · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216762-project-safe-transmute/index.html">project-safe-transmute</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216762-project-safe-transmute/topic/Musing.20on.20.60unsafe.60.20fields.html">Musing on `unsafe` fields</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="217189284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216762-project-safe-transmute/topic/Musing%20on%20%60unsafe%60%20fields/near/217189284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/216762-project-safe-transmute/topic/Musing.20on.20.60unsafe.60.20fields.html#217189284">(Nov 18 2020 at 20:04)</a>:</h4>
<p>The design meeting today made we want <code>unsafe</code> fields even more than I already did.  (The "but it still compiles if I don't mark the function as <code>unsafe</code>" seems like a foundational stumbling block for many, and IIRC there was another paper that even published a finding with a misunderstanding about it.)</p>
<p>If we had them, would there be a way for them to help out safe transmute?  Like suppose we had <code>#[repr(transparent)] struct Even(unsafe i32);</code> -- could we take advantage of that to improve the ergonomics of safe transmute too?</p>
<p>Would we need the same opt-ins anyway, so it wouldn't matter?  Or maybe taking advantage of it mean we'd need trait impls that are sometimes safe but sometimes unsafe, which might just be even more confusing?</p>



<a name="217199016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216762-project-safe-transmute/topic/Musing%20on%20%60unsafe%60%20fields/near/217199016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/216762-project-safe-transmute/topic/Musing.20on.20.60unsafe.60.20fields.html#217199016">(Nov 18 2020 at 21:27)</a>:</h4>
<p>the transmute just wouldn't be safe  i suppose</p>



<a name="217233206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216762-project-safe-transmute/topic/Musing%20on%20%60unsafe%60%20fields/near/217233206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/216762-project-safe-transmute/topic/Musing.20on.20.60unsafe.60.20fields.html#217233206">(Nov 19 2020 at 06:14)</a>:</h4>
<p>Maybe it would become impossible to <code>derive(TransmuteFrom)</code>?  Could presumably still be <code>TransmuteInto</code>, though...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>